package org.springblade.modules.repair.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.repair.enums.EmerProcTypeEnum;
import org.springblade.modules.repair.enums.MaintainPlanContentEnum;
import org.springblade.modules.repair.enums.WorkOrderTypeEnum;

import java.util.List;

/**
 * @Date 15:39 2022/7/1
 * @Description {
 *   关联维修任务详情
 * }
 * @Author lsay
 **/
@Data
public class CorrelationMalfunctionDetailVO {

	@JsonSerialize(using = ToStringSerializer.class)
	private Long planId;

	private String buildingName;

	private String elevatorAddress;

	private Integer elevatorStop;

	private Integer typeStatus;

	private String typeStatusName;

	/**
	 * 紧急程度
	 */
	private Integer emerProcType;

	/**
	 * 工单类型
	 */
	private Integer workOrderType;

	/**
	 * 紧急程度描述
	 */
	private String emerProcTypeName;

	/**
	 * 工单类型描述
	 */
	private String workOrderTypeName;

	/**
	 * 源工单类型
	 */
	private Integer sourcePlanType;

	/**
	 * 源工单类型名称
	 */
	private String sourcePlanTypeName;

	/**
	 * 故障信息
	 */
	private List<FaultMessageVO> faultMessageList;

	public void setEmerProcType(Integer emerProcType) {
		if(Func.isNotEmpty(emerProcType)){
			this.emerProcTypeName = EmerProcTypeEnum.getName(emerProcType);
		}
		this.emerProcType = emerProcType;
	}

	public void setWorkOrderType(Integer workOrderType) {
		if(Func.isNotEmpty(workOrderType)){
			this.workOrderTypeName = WorkOrderTypeEnum.getName(workOrderType);
		}
		this.workOrderType = workOrderType;
	}

	public void setSourcePlanType(Integer sourcePlanType) {
		this.sourcePlanType = sourcePlanType;
		if (sourcePlanType != null) {
			this.sourcePlanTypeName = MaintainPlanContentEnum.getName(sourcePlanType);
		}
	}
}
